/**
 * 盘点列表组件
 */
<template>
	<view class="fa-asset-list">
		<view class="fa-al-box pt-m2 pb-1 mb-1 bg-ff" v-for="(item, idx) in list" :key="idx" @click="$emit('methods', item)">
			<view class="flex-between pb-min font24 px-m2 col-gray" style="align-items: center;border-bottom: 1px solid #ECECF0;">
				<text style="max-width: 68%;" class="text-ellipsis">{{ item.EpcId }}</text>
				<span class="fa-al-status font24" :class="item.AlarmGuids.length > 0 ? 'error' : 'normal'">{{ item.AlarmGuids.length > 0 ?  "报警" : "正常"}}</span>
				<!--<span class="fa-al-status font24 wait" v-if="item.AssetStateName !== '正常' && item.AssetStateName !== '已删除'">{{ item.AssetStateName }}</span>-->
			    <span class="fa-al-status font24 wait" v-if="item.AssetStateName != '正常'">{{ item.AssetStateName }}</span>
			</view>
			<u-cell-item :border-bottom="false" hover-class="none" :arrow="false" class="px-m2 pt-1">
				<u-image slot="icon" border-radius="12" :width="size" :height="size" :src="item.Pics.length > 0 ? item.Pics[0].Url : '/static/images/icon_assets.svg'"></u-image>
				<view slot="title" class="fa-al-title pl-1 font24">
					<h1 class="font28 u-line-1 col-main">{{ item.AssetName }}</h1>
					<view class="col-mark">
						<view>{{ item.OrgName }}</view>
						<view class="flex-between">
							<text>{{ item.AssetTypeName }}</text>
							<text>{{ item.Num || '1件'}}</text>
						</view>
					</view>
				</view>
			</u-cell-item>
			<view class="flex-between font24 pt-m1 col-gray px-m2" v-if="desc == 'profit'">
				<view>该资产属于<text style="color: #2E73E5;">{{ item.OrgName }}</text>房产，请进行处理</view>
				<text style="color: #2E73E5;">去处理</text>
			</view>
			<view class="flex-between font24 pt-m1 col-gray px-m2" v-if="desc == 'loss'">
				<view>该资产<text style="color: #2E73E5;">丢失</text>，请尽快处理</view>
				<text style="color: #2E73E5;">去处理</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			list: {
			    type: Array,
				default: []
			},
			size: {
				type: String,
				default: '128rpx'
			},
			desc: { // 判断盘点列表呈现的是不是盘盈盘亏数据
				type: String
			}
		},
		data() {
			return {
				
			}
		},
		created() {
			
		},
		methods: {
			// 状态颜色
			statusColor(info) {
				let curClass = '';
				if (info == 'ASSET_STATUS_0001') {
					curClass = 'normal'
				} else if (info == 'ASSET_STATUS_0002') {
					curClass = 'wait'
				} else {
					curClass = 'error'
				}
				return curClass
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fa-asset-list {
		.fa-al-box {
			border-radius: 8rpx;
			box-shadow: 0px 8rpx 24rpx rgba($color: #3D4C62, $alpha: .12);
		}
		.u-cell {
			padding: 0;
			padding-top: 20rpx;
			line-height: 44rpx;
		}
		.fa-al-status {
			padding: 4rpx 16rpx;
		}
		.normal {
			background-color: rgba($color: #54E0A4, $alpha: .1);
			color: #2DC35E;
		}
		.wait {
			background-color: rgba($color: #2E73E5, $alpha: .1);
			color: #2E73E5;
		}
		.error {
			background-color: rgba($color: #E55D5D, $alpha: .1);
			color: #E55D5D;
		}
	}
</style>
